<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class login extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('muser');
    }

    public function index() {
        $data['title'] = 'Login';
        $data['login'] = true;
        $this->load->view('vlogin', $data);
    }

    function validate() {
        $username = $this->input->post('username');
        $password = $this->input->post('password');
        $login = $this->muser->get_login($username, md5($password));
        if ($login->num_rows() > 0) {
            $this->session->set_userdata('login', true);
            redirect('home');
        } else {
            $data['title'] = 'Login';
            $data['login'] = false;
            $this->load->view('vlogin', $data);
        }
    }

}

/* End of file login.php */
/* Location: ./application/controllers/login.php */